package org.gruposp2p.aularest.utils;

import java.io.IOException;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;

/**
 *
 * @author jj
 */
public class AulaLogger {

    private static final Logger logger =
            Logger.getLogger(AulaLogger.class.getName());

    private static FileHandler handler;

    public static Logger getLogger (String className) {
        Logger aulaLogger = null;
        aulaLogger = Logger.getLogger(className);
        /*
        try {
            aulaLogger = Logger.getLogger(className);
            aulaLogger.addHandler(getFileHandler());
        } catch (IOException e) {
            aulaLogger.log(Level.SEVERE, e.toString(), e);
        }*/
        return aulaLogger;
    }

    private static FileHandler getFileHandler() throws IOException {
        if (handler == null) {
            handler = new FileHandler("aula.log");
            handler.setFormatter(new SimpleFormatter());
        }
        return handler;
    }

}
